package org.example.struct.array;

/**
 * @author liyishan
 * @date 2023/12/7 09:02
 * @apiNote
 */

public class Test02697MakeSmallestPalindrome {

    public static void main(String[] args) {
        System.out.println(makeSmallestPalindrome("abcd"));
    }


    public static String makeSmallestPalindrome(String s) {
        char[] arr = s.toCharArray();
        for (int left = 0, right = arr.length - 1; left < right; left++, right--) {
            if(arr[left] != arr[right]){
                if(arr[left] <arr[right]){
                    arr[right] = arr[left];
                }else{
                    arr[left] = arr[right];
                }
            }
        }
        return new String(arr);
    }


}
